import 'package:flutter/material.dart';

class ListViewCase extends StatelessWidget {
  const ListViewCase({Key? key}) : super(key: key);

  List<Widget> getList() {
    List<Widget> list = [];
    for (var i = 0; i < 10; i++) {
      list.add(
        Container(
        width: double.infinity,
        height: 100,
        margin: EdgeInsets.all(20),
        alignment: Alignment.center,
        decoration: BoxDecoration(
            color: Colors.blue, borderRadius: BorderRadius.circular(10)),
        child: Text('第${i + 1}个'),
      )
      );
    }
    return list;
  }

  @override
  Widget build(BuildContext context) {
    return ListView(children: getList());
  }
}
